<template>
	<div class="ml-bg-extension-2">
		<div class="ml-bg-extension-003"></div>
		<div class="bottom-box">
			<p class="text1">恭喜您，注册成功！</p>
			<div class="ml-bg-extension-004"></div>
			<p class="text2">{{textContent}}</p>
			<div v-on:click="goDownload" class="dowBtn">立即下载APP</div>
		</div>
		<div v-show='isWechat' class="modal">
		  	<div class="pointer ml-icon-transfer-005"></div>
		</div>
	</div>
</template>

<script>
import request from "../../config/request.js"
import {bus} from "../../config/bus.js"
import judgeSystem from "../../config/judgeSystem.js"
export default{
	data() {
		return {
			dUrl:{
				ios:null,
				android:null
			},
			downloadUrl:null,
			show:null,
			isWechat:false,
			showBtn:false,
			textContent:null
		}
	},
	created() {
		var detect = judgeSystem.detect(navigator.userAgent);
		var self = this;
		if(self.$route.params.channel=='share'){
			self.textContent = "8元现金和100元现金券已放入您的账户，赶快去使用吧！";
		}else{
			self.textContent = "2%、3%、4%、5%共四张加息券，已经存放进您的账户，马上下载盈鱼理财APP吧！";
		}		
		var system;
		var channel;
		if(detect.os.ios){
			system = 'ios';
			channel = 'ios';
		}else{
			system = 'android';
			channel = 'yingyu686';
		}
		if(detect.app.wechat) {			    	
			this.$data.isWechat=true;
		}
		self.$.ajax({ 
			url:'/fish-backend/apis/app/getDownloadPath',   //提交的url
			type:'GET',
			beforeSend:function(xhr){		  	        		
				xhr.setRequestHeader('appidentifier',system);	
				xhr.setRequestHeader('source','web');
				xhr.setRequestHeader('channel',channel);	
		    },
		    success:function(res){
				self.$data.downloadUrl = res.data.downloadPath;
				self.$data.showBtn = true;
			}
		});	
			
	},
	mounted(){
		var h = window.innerHeight;
		this.$(".ml-bg-extension-2").height(h);
	},
	methods: {
		goDownload(){
			location.href = this.$data.downloadUrl;
		}
	}
}		
</script>

<style lang="scss">
.ml-bg-extension-2{
	background: #FFF5DC;
	.modal{
		position: absolute;
	    top: 0;
	    left: 0;
	    right: 0;
	    bottom: 0;
	    background: rgba(0,0,0,.7);
	    .ml-icon-transfer-005{
        	@media screen and (orientation:portrait) {
				width:50%;height:230px;background-image:url(../../img/icon/icon-transfer-005.png);background-size:100% 100%;background-repeat:no-repeat;background-position:center center;float:left;margin:0 auto; 
			}
			@media all and (orientation : landscape) {
	            width:30%;height:110px;background-image:url(../../img/icon/icon-transfer-005.png);background-size:100% 100%;background-repeat:no-repeat;background-position:center center;float:left;margin:0 auto;
	        }
        	
       	}
	    .pointer{
	    	position: absolute;
	    	top: 20px;
	    	right: 40px;
	    }
	}
	.bottom-box{
		.text1{
			font-family: PingFang-SC-Regular;
			font-size: 40px;
			color: #656565;
			letter-spacing: 1.75px;
			text-align: center;
			margin-top:40px;
			margin-bottom:40px;
		}
		.text2{
			font-family: PingFangSC-Regular;
			font-size: 32px;
			color: #656565;
			letter-spacing: 1.4px;
			width:85%;
			margin:30px auto 40px;
		}
		.dowBtn{
			font-family: PingFangSC-Regular;
			font-size: 32px;
			color: #FFFFFF;
			letter-spacing: 1.4px;
			background-image: linear-gradient(-90deg, #FE5133 0%, #FD5D29 100%);
			border-radius: 8px;
			width:85%;
			height:80px;
			line-height:80px;
			margin:30px auto 0;
			text-align: center;
		}
	}
}
</style>